<form class="navbar-form navbar-right" role="search" style="width:85%;">
    <div class="form-group input-group" style="width:100%;">
        <!-- type dropdown -->
        <div class="input-group-btn dropdown" style="width:1%;" ng-if="search.types">
            <button type="button" class="btn dropdown-toggle"
                ng-class="{
                    'btn-default': !search.params.t,
                    'btn-info'   :  search.params.t
                }" aria-haspopup="true" aria-expanded="false">
                {{search.params.t ? search.params.t : "Anything"}}
                <span class="caret"></span></button>
            <ul class="dropdown-menu">
                <li><a ng-click="
                        search.params.t = null;
                        search.params.q = '';
                        search.doSearch()">Anything</a></li>
                <li role="separator" class="divider"></li>
                <li ng-repeat="(ty, s) in search.types"><a ng-click="
                        search.params.t = ty;
                        search.params.q = '';
                        search.doSearch()">{{ty}}</a></li>
            </ul>
        </div>

        <!-- single search box -->
        <input type="search" class="form-control"
            ng-if="!search.getSourceFor(search.params.t).type"
            placeholder="matching any keywords, /regex/, field:term, ..."
            ng-model="search.params.s">
        </span>

        <!-- or, two search boxes with -->
        <input type="search" class="form-control"
            ng-if="sourceType = search.getSourceFor(search.params.t).type"
            placeholder="matching any keywords, /regex/, field:term, ..."
            ng-model="search.params.q">
        <span class="input-group-addon"
            ng-if="sourceType = search.getSourceFor(search.params.t).type"
            style="width:1%;">
            from
        </span>
        <!-- another one for constraining source type -->
        <input type="search" class="form-control"
            ng-if="sourceType = search.getSourceFor(search.params.t).type"
            placeholder="{{sourceType}} matching any keywords, ..."
            ng-model="search.params.s">

        <!-- search button -->
        <span class="input-group-btn" style="width:1%;">
            <button type="submit" class="btn btn-primary" ng-click="search.doSearch()">
                <i class="fa fa-search"></i><span class="sr-only"> Search</span></button>
        </span>
    </div>
</form>
